<script setup lang='ts'>
import { PureTableBar } from "@/components/RePureTableBar";
import { useEcommercePlatform } from "./hooks/LineApplication";
const {
  rules,
  columns,
  loading,
  dataList,
  pagination,
  handleSizeChange,
  handleCurrentChange,
  DialogVisible,
  EntryPlatform,
  projectList,
  countMoney,
  CloseEntryPlatform,
  SubtimEntryPlatform,
  changeDate,
} = useEcommercePlatform()
</script>
    <!-- 入住电商平台 -->
<template>
  <div class="main">
    <PureTableBar title="融资额度核定申请列表" class="list_hei">
      <template #buttons>
        <el-button type="primary" @click="DialogVisible = true">融资额度核定申请 </el-button>
      </template>
      <template v-slot="{ size, checkList }">
        <pure-table border align-whole="center" showOverflowTooltip table-layout="auto" adaptive :loading="loading"
          size="small" :data="dataList" max-height="600" :columns="columns" :checkList="checkList"
          :pagination="pagination" @size-change="handleSizeChange" @current-change="handleCurrentChange"
          :header-cell-style="{
            background: 'var(--el-table-row-hover-bg-color)',
            color: 'var(--el-text-color-primary)'
          }">
        </pure-table>
      </template>
    </PureTableBar>
  </div>

  <ReDialog :width="700" :height="300" :models="DialogVisible" @Closes="CloseEntryPlatform()">
    <template #header>
      <h2 style=" text-align: center;">融资额度核定申请窗口</h2>
    </template>
    <template #main>
      <!-- 入驻平台窗口 -->
      <el-form label-width="180px" ref="RefEntryPlatform" :rules="rules" :model="EntryPlatform">
        <el-form-item label="申请日期：">
          <el-date-picker type="date" format="YYYY-MM-DD" value-format="YYYY-MM-DD"
            v-model="EntryPlatform.applicationDate" placeholder="请选择日期筛选出项目" @change="changeDate()" />
        </el-form-item>
        <el-form-item label="应收账款项目：">
          <el-select placeholder="请选择" v-model="EntryPlatform.arcId" multiple @change="countMoney()">
            <el-option v-for="item in projectList" :key="item.purchaseOrderId" :label="item.purchaseName"
              :value="item.purchaseOrderId" />
          </el-select>
        </el-form-item>
        <el-form-item label="应收账款总额：">
          {{ EntryPlatform.loanMoney }}元
        </el-form-item>
      </el-form>
    </template>
    <template #footer>
      <span class="dialog-footer">
        <el-button type="primary" @click="SubtimEntryPlatform()"> 确定 </el-button>
        <el-button @click="CloseEntryPlatform()"> 取消 </el-button>
      </span>
    </template>
  </ReDialog>
</template>

<style scoped lang="scss">
@import url(@/style/CreditComm.scss);

:deep(.el-dialog__footer) {
  text-align: center;
}

:deep(.el-form-item__label) {
  font-weight: 700
}
</style>
